Simple Euclidean algorithm